Page({
  data: {
    banners: [
      '/images/banner1.jpg',
      '/images/banner2.jpg',
      '/images/banner3.jpg'
    ],
    notices: [
      { id: 1, content: '本周六放假一天', time: '2024-06-01 10:00' },
      { id: 2, content: '下周一正常上课', time: '2024-05-31 16:30' }
    ],
    newNotice: '',
    activeTab: 0
  },
  onNoticeInput(e) {
    this.setData({ newNotice: e.detail.value });
  },
  publishNotice() {
    const { newNotice, notices } = this.data;
    if (!newNotice.trim()) return;
    const now = new Date();
    const time = `${now.getFullYear()}-${(now.getMonth()+1).toString().padStart(2,'0')}-${now.getDate().toString().padStart(2,'0')} ${now.getHours().toString().padStart(2,'0')}:${now.getMinutes().toString().padStart(2,'0')}`;
    notices.unshift({ id: notices.length + 1, content: newNotice, time });
    this.setData({ notices, newNotice: '' });
  },
  goAttendance() {
    wx.navigateTo({ url: '/pages/attendance/list/list' });
  },
  goDiet() {
    wx.navigateTo({ url: '/pages/diet/schedule/schedule' });
  }
}); 